package com.zcx.provider2.rabbitTest;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;

import java.io.IOException;

/**
 * @author zhaochangxin
 * @date 2022/3/7 11:21
 */
@Component
public class RabbitConsumer {
    @RabbitListener(queues = {"internal_project_zcx_testMQ"})
    public void consume(@Payload String body, Channel channel) throws IOException {
        System.out.println("接收到消息：" + body);
//        channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
    }
}
